package com.example.lottery.controller;

import com.example.lottery.common.pojo.CommonResult;
import com.example.lottery.common.utils.CapthchaUtil;
import com.example.lottery.service.IVerificationCodeService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private CapthchaUtil capthchaUtil;
    @Autowired
    private IVerificationCodeService verificationCodeService;
    @GetMapping("/t1")
    public CommonResult getCaptcha(HttpServletResponse httpServletResponse){
        System.out.println(capthchaUtil.createCaptcha(httpServletResponse));
        return CommonResult.success(null);
    }
    @GetMapping("/t2")
    public void sendVerification(HttpServletResponse httpServletResponse){
        verificationCodeService.sendVerificationCode(httpServletResponse,"13148722443");
    }
}
